A lot of duplication here. Could be condensed to two lines?