Thanks for this. For future reference, you might want to know that you can wrap code with [code] tags to make it appear nicer, keeping indents etc.