Refactor to group by feature the classes