separated code to own files

thanks to comment from Andrew on http://docs.angularjs.org/guide/module