First version. Doesn't work with unicode chars.