Refactoring s390 code and fix for bnc813835
Updated changelog.