Fixed several warnings and a little cleanup.