More tests and some style fixes