Rewrite ramdisk script, lots of cleanup