initial revision: just a few useful functions