Refactor to match latest sample application