extract warn method

if you merge please test it, cause I didn't ;-)
Merge pull request #1 from spaghetticode/patch-1

extract warn method