Refactor and fix User model