improved mappings, added redirect writer, various bug fixes