Move variable definition to before filter