Added validation to ensure multinomials are well formed + refactoring