unfuddle script, to be tweaked