improve comments and organization