Refactors bst.py - Tests passing. Consolidates excessive logic.