more refactoring and tests profile tab