Another attempt to fix logic