get travis running & refactor code