refact, optimization