Modified the router before events for the flashcards and profile screens