Refactor the weasel program