Added support for applying patches