Updated JS, I think I'm getting close to solving this.