Code refactoring for BT Server