Refactors to use resources