several changes: nolog, comments and some logic

added -nolog to disable logging
added some simple comments
changed some logic on detecting some variables