this is the code I used and it seemed to work