Fixed a problem in the code whereby it doesn't wait for KEY0 to be pressed