new type QBox and some code improvements