Refactored parts that are specific for mock framework