candidate: The purpose of walls was to extract market and other tolls from people entering or leaving the town , to demarcate an area where craftsmen could work freely without being subject to feudal service and dues , and to provide basic security for the inhabitants .