improved string handling of input