Improved the variable declaration detection (multiple declarations with one var used to fail, also added some log functions