Implemented function that prints nodes on console

- printing
- refactoring
- commens