adding cleanup code to views