cleanup and debug stuff