finished NAV generating code