added inner classes, still incomplete