Moved some common helpers to 'JavaScript' and made them nicer to use.