Adapted to newest libs (WIP)