corrected BP, Buffer, etc; thoroughly tested