changed 'location' variable to 'beginning'