Adding travis testing

This adds travis and coveralls integration for all tests. You could change the badges urls to your own. 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.