fixing up some of the code