More adaptations from old implementation