Unit testing now implemented. Fixed many issues showed by the unit test. TravisCI has been added.