code polishing, notes added