Slight refactor on value extraction