Code structure changces

Following https://github.com/johnpapa/angularjs-styleguide