some general cleanup and random adjustments