added more logic and notes for report flexibility.