Added logic to login