Fixed some keypresses. Need to work on display() algorithm as the running time is poor.