Added cleaning logic

TODO : refactoring