move boilerplate to before and after render