Updated the encoder routine to use push button