Mostly casts here and there to kill warnings or bugs. occasional addition of prototypes and/or changes to bring protos into scope.