refactor dump handler