Fix warnings and other cleanup