This is ugly. Helpers might make it cleaner.