Typo
Added slot number check
Refactored functions
Generate population