Implemented server-side cleaning logic