couldnt get recursive function to work