Unittest

Cover ~80% of the codes