adapt to new API

Changes made to confirm to new API. Most changes made are signed with
{ck}