I think you can use your pool_exists() function, it will be more simple..:)