Added some optimization