Also missed some braces in an if statement. Need. More. Coffee.