Refactor resource singleton