Added Unit tests and modified files required to make testing work.