Update SM file reader function to decode the header