Added debugging functionality