Refactor login form