Adds proper js queue (and fixes all js problems)