completed implementation of Refactor, does not pass checkstyle.
not tested.