some clean-up and documentation