code cleanup, evaluation function