polish some stuff and add clear functionality