Made code shorter and probably more performant