Improved function documentation in tools/preview.js