Unit tests for new code upto mid term.

Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>

Fix coding style and code duplication.

Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>

Code refactor.

Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>

Remove unused code.

Signed-off-by: Ashutosh Dhundhara <ashutoshdhundhara@yahoo.com>
Merge pull request #1282 from ashutoshdhundhara/unit_tests

Unit tests for new code upto mid term.