Made some optimizations for C++ 11