Allowed code blocks to retain context
Several bugfixes