migrated the original code