Final version of hacky trying-stuff-out code.