refactors template setup code into helpers in Lightsquare