Added unit test projects. Many bugs are eliminated.