moved functionality to user model