updated to the latest implementation