Added clear button and fixed bug