refactoring usage of resource & input