added clear all and other bug fixes