fixed indentation and functions, added catalog read functionality