Refactor around the function resolver