Tests written, minor bug fixes