A small set of useful js functions