added debugging output and status messages