Main functionality, with clear button