Pure js version