Testing and improving javascript