Changed the loop to check for the request type from SWITCH CASE to IF statements