Refactor and better structure.
Logger added.