Added comments and fixed small bugs with auto-merging teams