Refactor to eliminate use of deferred library