added clear button and made it work properly