updated navigation logic