Orevall refactoring. Extracting of various lines of code into partials and modules.