Added length prior and fixed probability=0 bugs.