an implementation of the weasel program