refactor with new entities