Tidier way of doing this code?

Printable View