refactored code to separate test scenarios from implementation
added tests for the profile page