location sample code from Apple