Add cookie and optimizted code