Removed unnecessary prints and extended generate command to show total result