added dynamic type handling to boxes