I am not sure if this is the right way of doing this i.e. without actually using Next/Previous, but I dont think it should matter since we are checking template vars