Can we do this without duplicating this entire block of code?