clean-up code and commenting