Added functionality for login and register