Refactored code and updated travis.yml file.