remove syntax errors and cleanup