Reorganized a bit before getting to the interesting parts