cleaned up some entity code