Fixing legacy code