Clean up JavaScript and tests