Simpler entity api

Merge code of Morris.
Update code.
Fix errors