Created dynamic function to clear table