Update JS to use class-based functionality