Refactoring display

Please check out this solution. On a side note, I believe there is a third case too, preparePMContext(), we may want to try tackling the similar way.