incorporate old code, to be migrated