cleaned up comments, rearranged for clarity of assignment