Bit of code cleanup and explicit variable handling