fully commented motif.py, and made minor changes to simplify usage