minor changes, still incorrect if statement