refactor to make resource checking async - #1