refactoring, adding support for text/plain
moving configuration to config file