Added basic entity API, minor code improvements - closes #2