moved variable declaration before the "before"block