Updated clear() method