Various helper functions for JS