rebuilt from the latest implementation