This is the simpler solution for issue #64 proposed by @bjorn.
logic() gets called on every tick after input is processed so I removed redundant code from keyPressed().
logic()
keyPressed()