refactored inner classes
removed warnings