added parsing of csdl
some tidy up