rewrote as class in javascript