Made some small optimizations