Refactored Gatekeeper