Added comments, some minor changes