Check and combine the 3 repetitions
Removed debug output