this is probably more readable until I split out some templates