Implements correct config scoping (incl. directories)

Enables each block to change directories and adjust other
configuration options. Changes are lexical to the given
block and are reset once a block has been processed.