Removed extra empty line from log.
minor code structure refactoring: moved vars to the function top