Optimized code, see notes on OneNote