Removed syntax errors, several minor improvements