Refactored messy render, to use a conditional child component instead.