fixed for varying distributions
fixed for all forms and added debug