Refactor to latest version