Fixed syntax errors, logic errors, etc