changed to inner classes