Updated download function and sync command