Topics/refactor directives

A real monster commit.