move variable definitions up to allow goto