Improved detection of unused variables