revamp js structure