add wrap handler
refactor handler