Made some optimization