refactored to use getResource() in place of all file access