Improved evaluation function.