added reading from file and debugging output