rewrite C code to support LongVectors; closes #13