more comments for select, code cleanup