Fixed syntax error
Fixed some terrible logical errors