Final refactor