Smattering of updates and changes to a whole lot of functions. Also added two new auxiliary functions, comp_struct and getMatchingStruct.