Refactoring user detection on back-end; routes on front-end