Added Unity for IOC plus some tests

and some refactoring