the magic code evaluate function