reorganized build.sh, moved command line logging

from the .py scripts to build.sh.
some more comments and simplifications in _prepare_html