adding optimization piece