updating cleanup of views to prevent memory leaks