Sourcecode clean-up & format. Added two new unittests