code cleanup/corrections