Cleaning up some generation/sample changing code.