Refactored to use generics for study parameters and conditions
Bug fix for some NM templates