refactor dashboard js