Refactor resources class and template