Move code to os.module