less alloc. and a test case