Started refactoring model out into its own file and moving methods from $scope to the model.