Finalised JavaScript for Perform Test