made generic navigateTo function