Move $skip_pools populating to function