Added pseudo code for authenticate function