Added Title logic and updated if statement logic