BER turned into function
BER function