Removed redundant null checks
Renamed variables to make them more understandable