moved broken logic to js