Is it possible to simplify this code?

I made a proposal about this