changed backup script to be more general and tweakable