noted that I forgot curly braces in my if conditions for javascript