removed obsolete each statement and added variables for both body class and title