A tiny JS version that can be called multiple times