added loginSpec and refactored frontend code