logic still wrong here somewhere