Fixed syntax errors and a couple logical issues.