Editted motif.cpp