refactor (all): add YUIDoc-compliant docs and reorganize code

Add lots of missing documentation in YUIDoc format
Reorganize code to be more consistent and logical across files
Minor cleanup in some places (removing unnecessary variables, moving
variables and functions off of $scope, etc)

Closes #234