better implementation of getting resources