Various cleanup, fixes