Update template, detect orientation change