Add auto-update, minor bug fixes for main fcn