In particular embodiments of the present invention, a method for switching is provided. In particular embodiments, the method includes receiving a packet at an input port of a switch, the packet associated with a virtual local area network identifier (VLAN ID) and a Media Access Control (MAC) address, the switch comprising a forwarding database and a plurality of output ports. The method also includes masking the VLAN ID to create a masked VLAN ID comprising fewer bits than the VLAN ID associated with the packet. The method further includes applying a function to the MAC address and the masked VLAN ID to generate an index, and, at the forwarding database, using the index to identify an output port of the switch. The method also includes transmitting the packet from the identified output port.