refactored working with pool state