Added unittests and made style changes