refactored code for better organization of structure.
removed the headers parameter since it is not necessary for the login procedure.