Fixing some if statements and looks