improved test code