refactors Resource as class