commenting and clean-up of code