used warning function instead of the warnings