updated target functions, register functions, calculating distance from user and target etc