whitespace, cleanup
refactored duplicated code
removed unused entity field
fixing compile error
test fix
test fix