Refactoring
Added user data handking and tests