Refactoring
Put code in separate files
Implements population and generation counters