removed global leak
added global leak detection
matched code style
added source comment