Trying to fix logic