Rewrote navigation core functions to work with concept of documents