Fixes #134. Fix unit testing issues. Add more tests to cover more code.
Restructure the whole project tree so that the component can be unit tested. Also update some cmake files to update the modified paths, update test cases etc.