Refactor file loading code to be case insensitive