cleanup while porting to JS