First part
Fixed the reading function