Refactor js code
Improve adaptive layout
Fix auto restart bug