fixed indentations and functions, added catalog read functionality