Bind helpers and fix middleware generator
Refactor handlers