Some minor improvements ans cleanups