commented documentation and added replay option at end