Added keypad and sound generator, and separated out some code