Implemented evaluate function.