Refactored to ensure setup of request is encapsulated and pem files are filtered.