webapp handlers refactor