work in progress to simplify + fix comparator