Add Optimizely integration and clean up code