fix js so can only click once
eliminate double click error, refactor slightly