Refactored stuff for the better testability and up to new paradigms.