Clang fix. Closes #295, closes #50, closes #309.