Helper functions for JavaScript