Reorganizing and removing unused code.