implement and debug a quad tree