optimization, excluding empty values