First stab at a proper test suite (already >= 90% coverage)