bug fixed && new structure for JS