Updated to loop through provided resources