This and the following method can be DRYed up.