Refactor User model and test