fixed clang complaining about C++11, and removed duplicated code
Merge pull request #300 from bmorel/master

fixed clang complaining about C++11, and removed duplicated code