Small improvement

Use strrpos instead of strpos to find the index of the filename
extension