New functions added to login and register