style changes and fixed file reading