Fixing bad logic