Refactored for adding more tests for completeness of Login and Register