Modularize box code.