Lots of debugging and changing of functions, mostly to deal with missing attributes