Update demo code and refactor ORM entities