Small javascript impruvements