More modular functions for generating samples, updating, and plotting