Made few optimizations