Fixing constraints, moving login logic to service