Changed structure to allow different types of extension