Entity engine

Need to merge this in so we can use master again.