Initial code dump. No time to explain it all. This is months of stupid design decisions and minor strokes of genious, which gave me headaches at first, but now I seem imune.