Make better use of closures.
Make better use of closures.

In some cases variables were initialized outside the function in which
they were needed.

montagestudio/montage-data,montagestudio/montage-data,montagestudio/montage-data