Preprocessor fixed and unit tests added.