rewriting large sections, making it less stupid.