added cleanup logic to profile