code cleanup in plots