Major commit. Rewrote all of the functionality to use functions so the UI is absolutely independent of the backend