Some helper functions for JS