working some optimization