Improve handling of empty values and trim values.
Simplify - remove unnecessary method and inline its code.