This is approaching helper function territory but probably ok for now.