More tests + minor bug fixes