added clear function and other updates