refactored and generalized simulation/data synthesis