Slightly improved the comparators and added comments to several classes