cleanup and some conditional rendering