completed javascript

app now runs as intended.