try to reduce frames referenced by callback fuctions. Some cleanup.