I tried to optimize it, but I was testing my optimizations on a gaming laptop which made it hard to see what made a difference (T^T)