Protect Location routes, added tests and reformat code (spaces)