Refactoring and integration with bacs::common.