hm, this seems like something we can write more compactly. There's a lot of string repetition and prefixing that looks like it can be optimised... open note though