replaced keydown() else ifs with switch