seperate out most of the cat functionality to a library