code cleanup + comments