! add comments, cleanup code, fix "c++11"