refactored functions location, added 'all' parameter