Rewrite js codes further
Add model selection