fix red line code; clean up code