renamed reserved symbols. fixed some errors/typos and indentation

I used pylint to check for errors and warnings. However, there are still some unresolved warnings to fix.