Remove hardcoded executable extensions and rely on detect of magic 'MZ' flag.
Reduce scope on some locals, remove some useless comments.