some code changes mostly related to style and C++11