added extra logic for subject handling