Improved directive parsing, and separate test class for parsing directives.