Integrate testing and build process. Also fixes #23