wordy, but it works