cf35bbeb50
remove templated types as much as possible for type safety; add more comments; clean up code, add const if possible;