Broke the accept function into two different functions to fix a security issue.