modifications in main logic, reset method introduced