Implemented the demo logic