Added functionality for saving stimulus, checked validity. Bug fixes.