Removing repetetive resource query code. #3