fixed js after reading comments 2 & 3 about DRY and booleans