Refactored copy paste code to appease travis.