Factored core functions out of Eval()