Finalized comments & general cleaning. TODO: add preconditions and traversal