Code tweaks and auto-update function.

Code tweaks and auto-update function.