major rewrite of the selection of which code block. probably still buggy, but it does compile itself.