Updated to match the latest API