Remove unused code within getResource() function