Functions in bps.h