Added some little optimizations