Fixed bugs and added clear button