adding comments and reordering variables