Crudely transformed into nodejs