cleaned up code a bit, added entity config