What parts could I get rid of?
Most of it.
When you write nearly the same line over and over you can replace it with one line in a for loop, with the part that changes as an array.
So for a start all those pin mode calls could be replaced by two lines.