The milking unit comprises a milking machine, a teat position sensor (usually a laser), a robotic arm for automatic teat-cup application and removal, and a gate system for controlling cow traffic. The cows may be permanently housed in a barn, and spend most of their time resting or feeding in the free-stall area. If cows are to be grazed as well, using a selection gate to allow only those cows that have been milked to the outside pastures has been advised by some AMS manufacturers.