fixed typecast for the comparator and made some methods private in edit.