Moved getResources to util, improved impl