moved redirect block to top of beforeFilter function