More tests and tweaks