added logic to switch required params into query params