Cleaned up ngcontroller javascript snippet