abandonned modulization, used let block instead
corrected forgotten external var in refs