moved BTA related code into external cpp file