major refactor

* Modularised the cli from the main functions
* added tests
* added travis ci