Refactor using new api of pot