implementing reading from file