Merged bp.h and bp.cpp from SVN head