rebased code for meteor