Cancel buttons and refactoring

I have refactored some methods and variables to match common practice.

The cancel buttons on the password prompts now works

Lots of state diagrams work now more to be completed