new shm routine + wafile mods