refactor relative probability and successfully run it.