better state control,l, template rendering