added Test Project containing some unit tests and fixed some bugs; some refactoring;