Refactoring of Pimcore::run

this is a refactoring of the pimcore::run method to reducte the code cpmplexity and ensure that it is possible to overwrite and extend from the class.

please review carefully.