adding some debugging functionality