moved var declaretion closer