getentity added and optimizations