revised script to actually work :-)