Fix issue #3 by tracking identifier occurrences separately from declarations