clean-up and a little reorganization