Added named pipes to uploadfile to avoid having to dd from disk twice.  Code's messy now, but it should run faster.