bug fixes

replaced innerHTML with textContent, improved $$ function