Moved the last functions out of utils.js and into User model. New tests