added gritter functionality; fixed javascript issue