Added tests. Did some refactoring
Added tests running to travis