A lot of changes to make the app more AngularJs-like