added specs, modify code to add  more error codes and ignore invalid file extensions