Aargh, variable scoping