refactor cleanup extra logic