Set up testing environment, and minor bug fixes