Refactors the format plugin

Behaviour was not changed. Only restructuring and removal of duplicate code.
Improves b/strong, i/em handling