move to pure js