merged legacy code