Added tests for User model.
Updated code style in model itself.