Updated Goal javascript to be tidier