How do I stop repeating code in similar functions?

Printable View