refactor to entities