better api for multiple handler, codegen