refactored inner classes to avoid pyjnius error