Fixed an error in the code to get it to work