Replaced if($remote) checks with initial return statement