Improved "getFileExtension" function.