I've corrected the code above.
In reply to Re^11: Out of memory problems by BrowserUk in thread Out of memory problems by tperdue