optimize entity.hpp