Various improvements in robustnes via static_assert(), etc.