Added simpler syntax for C++11, fixed various problems