Adding some small optimizations