get file types by extension, some refactoring