Added missing then statements