added rerouting using $location