minor code cleanup and logging change on resource queries