changed some things in the self-localization method