Before a drive, a cowboy's duties included riding out on the range and bringing together the scattered cattle. The best cattle would be selected, roped, and branded, and most male cattle were castrated. The cattle also needed to be dehorned and examined and treated for infections. On the long drives, the cowboys had to keep the cattle moving and in line. The cattle had to be watched day and night as they were prone to stampedes and straying. While camping every night, cowboys would often sing to their herd to keep them calm. The workdays often lasted fourteen hours, with just six hours of sleep. It was grueling, dusty work, with just a few minutes of relaxation before and at the end of a long day. On the trail, drinking, gambling, and brawling were often prohibited and fined, and sometimes cursing as well. It was monotonous and boring work, with food to match: bacon, beans, bread, coffee, dried fruit, and potatoes. On average, cowboys earned $30 to $40 per month, because of the heavy physical and emotional toll, it was unusual for a cowboy to spend more than seven years on the range. As open range ranching and the long drives gave way to fenced-in ranches in the 1880s, by the 1890s the glory days of the cowboy came to an end, and the myths about the "free-living" cowboy began to emerge.