Is there any way we can remove this duplication? Lines 268-271 and 298-301 are identical.