Some refactoring. NB: Next candidate for format translator...