restructure Login Helper logic