Add extend and events functions