clumsy implementation of prob calculation