refactored resulthandler out