fixed bug in data initialization; added reading from file