refactor against hadoop trunk