Was hoping somebody had posted this method - too often the beauty of pattern matching in function heads is forgotten!