refactor request handling: add generic handler interface, cleanup, ...