Fix syntax errors, cleanup