c++11 - use c++ style casts + cleanups + use std::fill
use c++ std::fill/copy instead of c-style memset/memcpy
more c++