Warning fixes and minor cleanup