Code cleanup, add support for markdown