copied in test code