refactroring and a few predefined examples