refactor Resource