refactored how psgi apps are loaded

refactored how psgi apps are loaded

fixed test and documentation