Adapted to new library API