refactor requestaccess code