Adding travis testing

This adds travis and coveralls integration for all tests. You could change the badges to your own settings. I'm going to be commenting on all the specific changes that I made to the code in the comments. I hope this is useful.