Make PriorityEncoder interface more generic