Added visual leak detection and minor edits