Refactored flat value handling.