modularize scripts and fix js dependencies