fixed reading from file, added define and reading of generation number