Improved functionality of User.php