consolidate functions
use unified function