added debugging functionality