Finally adding some unit tests

*Added some basic unit tests (and corresponding code changes to facilitate in this process)
*TODO: Add some more! :)