added selfpermutation check, changed some on random form generation