There's an easy fix: take the three line block that keeps getting repeated and turn it into a method.