Javascript convenience functions that likely won't be useful for anyone else