fixing up the code