readability changes, added more comments