work before templates