trivial changes including rearranging and removing unused code