add simple and advanced optimizations