misc rewrites, string/matrix functions