refactored resource instantiation