function for ecitmatch, with docs and tests. Closes #9