Merge. with existing implementation of sync().
Mod. Changed all os calls to utimize subprocess.