clean legacy code