Applied some optimizations