Functional buttons

Made buttons functional.

Added some underlying structure for mode switching.
Forgot these

Didn't add these on last commit.