Updated extensions class to make the code easier to understand