refactored how psgi apps are loaded