added more comments; increase legibility