Added check for authentication and changed order of angular controllers