catalog: made refactor. Not tested yet.
catalog: io refactor tested. Not all is tested.