Made code less computationally expensive