Split out entity.js