Refactor code update and management commands to allow easy running at either boot or runtime