improved the give-all-positions function