updated main
added probability calculation