Refactored - works like a charm now.