more code cleanup
fix indentation warnings and warnings about boolean equality
code cleanup, reuse existing code
more code cleanup
code cleanup