Reduce this into one method if possible.