Saving entity changes

and some minor changes