minor: code polishing + comments