refactored js structure and names