Refactor pure static eval code