Added box stuff

Boxes are not accounted for in the printing. Also added a thread-safe
printing function to avoid using sprintf/puts combinations for every
print.