Working version of cat using iolib