started a better logic for authentication
repeat