Only extend classes when needed