lots of namespace etc fixes, many features