Guest-only check for login-related pages + moved internal methods to separate folder