Refactor and migrate to request / xhr