Rewrite of clearing for zepto support and new JS structure.