Overhaul of stimulus creation functions and added some helper functions to streamline things.