finally got rid of arraysearch (unecessary), added clear function