Entity Cleanup: Part 2

Cleanup of the entity code to have a more pythonic interface. 
Add docstrings.