Clean up value expansion algorithm per Markus' feedback.