refactored, fixed highlighting bugs
implemented preserve prefix option