Refactored to only support bamboo-compatible output.