Travis fixes.
Updated tests and refactored.