Fixing crappy code