optimize string operations a bit