Made a generic function to deal with button pressing (deleting around 600 lines of code).  Tweaking to making it perform correctly.