First refactoring
Initial import
further refactoring of gen_pool