changes to improve performance on close, more debug statements, removed overflow tracking