Fixing up code