lots more entity code