Made some improvements in methods for reading data from file