Reworked nav function