Adding user model/refactoring code