Declare variables at point of use

Defer variable declaration until the point when they are actually used.