function evaluation and some error throwing/catching