Moved variables to just before use.