ahammett: minor refactor of js for future changes