formatting cleanup; added some useful logging