Fixed logic flaws in adding users and hosts. Made other improvements. PythonTidy.