Placement of scripts in the code, and related questions

Why there are scripts being placed at the bottom of the code after footer, and some at the top inside head tag? What is the sorting convention used in Wappler.

Also, the generated code formatting is not as neat as in DW, for comparison. For example some generated codes have indent before < and some don’t. Is there option to auto format source code or source formatting function being planned in the pipeline?