refactored boosting code