User model, security lib refactored