Added entity.js and tests