Added logic for auth