wrote functions for test code