externalize some logic, update deps