box: Add 'precedence' parameter which determines the box position.
write: Refactor the box writer module.