Refactored the clear function to be more generic