I'm glad you all found it useful - I also spent evenings banging my head against a wall trying to solve this.