added cleaner implementation