initial work for automatically commit and refactored the initialize code

this hangs at startup so don't use it