Consolidated pool write functions

Inpool and Outpool functions are merged and suitably modified for chunk
handling, which still needs to be added.