script to do the basic dirty work