updates javascript to follow best practices