updated to use new entity system