Defineformat: Completely changed implementation, fix bugs with newline, indents, search/replace and other