copying from rnacounter.cc