improved logging & minor cleanup