Fixing up the code