refactor and rename resource to var