added conditions to check is request is being passed, if not then handle it the old way