Fixed issue with array cloning and added clear feature