clean up some resource usage and some extra debug cruft