Closest implementation of BP