cleaned up pool code