Added support for custom extensions specified. Backwards compatible