updated with a working extension method