improved quote detection, closes #4